home *** CD-ROM | disk | FTP | other *** search
- .xlist ; hide this entire file from .LST file
- .xcref ; hide the symbols from .LST & .REF files
- ; a number of generic DOS 2.0 functions
- .xcref close
- ; close
- ; macro to close file
- ; input
- ; handle - the file handle to close
- close macro handle
- mov ah,3eh
- mov bx,handle
- int 21h
- endm
- .xcref delete
- ; delete
- ; macro to delete file
- ; input
- ; which - asciiz string of file to delete
- delete macro which
- mov ah,41h
- lea dx,which
- int 21h
- endm
- .xcref lseek
- ; lseek
- ; macro to move file ptr
- ; input
- ; handle - handle of file
- ; offs - immediate offset ot move file pointer
- ; mode - how to move the file pointer
- lseek macro handle,offs,mode
- mov ah,42h
- mov al,mode
- mov bx,handle
- mov cx,offs / 0ffffh
- mov dx,offs mod 0ffffh
- int 21h
- endm
- .xcref open
- ; open
- ; macro to open a file
- ; input
- ; fname - asciiz string of file to open
- ; mode - the mode to open file for
- open macro fname,mode
- mov ah,3dh
- mov al,mode
- lea dx,fname
- int 21h
- endm
- .xcref read
- ; read
- ; macro to read from a file
- ; input
- ; handle - handle of file to read
- ; buffer - where to put stuff read
- ; len - number of bytes to read
- read macro handle,buffer,len
- mov ah,3fh
- mov bx,handle
- mov cx,len
- lea dx,buffer
- int 21h
- endm
- .xcref write
- ; write
- ; macro to write to a file
- ; input
- ; handle - handle of file to write
- ; buffer - where to put stuff write
- ; len - number of bytes to write
- write macro handle,buffer,len
- mov ah,40h
- mov bx,handle
- mov cx,len
- lea dx,buffer
- int 21h
- endm
- .xcref setvector
- ; setvector
- ; macro to set interrupt vector
- ; input
- ; which - the interrupt vector number to set
- ; where - the location to set to (assumed to be in DS)
- setvector macro which,where
- mov ah,25h
- mov al,which
- lea dx,where
- int 21h
- endm
- .xcref print
- ; print
- ; macro to print out a '$' terminated string
- ; input
- ; what - the string to print out
- print macro what
- lea dx,what
- mov ah,9
- int 21h
- endm
- .xcref resident_exit
- ; resident_exit
- ; macro to terminate a process w/ stay resident
- ; input
- ; where - the end of the what need to be preserved
- resident_exit macro where
- mov ah,31h
- lea dx,where
- int 21h
- endm
- .xcref exit
- ; exit
- ; macro to terminate a process w/ error code
- ; input
- ; code - the error code to return
- exit macro code
- mov al,code
- mov ah,4ch
- int 21h
- endm
- .xcref putchar
- ; putchar
- ; macro to print one char to stdout
- ; input
- ; char - the character to print
- putchar macro char
- mov dl,char
- mov ah,2
- int 21h
- endm
- .xcref setdta
- ; setdta
- ; macro to set the dta address
- ; input
- ; where - the address of the new dta
- setdta macro where
- lea dx,where
- mov ah,1ah
- int 21h
- endm
- .xcref dta_type,dta_reserved,dta_attr,dta_time,dta_date,dta_size,dta_name
- ; define dta after a dir search for MS-DOS 2.11
- dta_type struc
- dta_?attr db 1 dup(?) ; the attribute you were looking for
- dta_?drive db 1 dup(?) ; the drive you were looking on
- dta_?name db 11 dup(?) ; the file name you were looking for
- dta_reserved db 8 dup(?) ; I assume sectors where file was found
- dta_attr db 1 dup(?) ; the attribute of file found
- dta_time dw 1 dup(?) ; the time of file found
- dta_date dw 1 dup(?) ; the date of file found
- dta_size dd 1 dup(?) ; the size of file found
- dta_name db 13 dup(?) ; the name of file found
- dta_type ends
- .xcref is_normal,is_read_only,is_hidden,is_system,is_label,is_dir,is_archive
- ; define directory entry attributes
- is_normal equ 00h ; bit map for normal files
- is_read_only equ 01h ; bit map for read only files
- is_hidden equ 02h ; bit map for hidden files
- is_system equ 04h ; bit map for system files
- is_label equ 08h ; bit map for labels
- is_dir equ 10h ; bit map for directories
- is_archive equ 20h ; bit map for none archived files
- ; define the standard devices
- .xcref stdin,stdout,stderr,aux,prn
- ; define the standard handles available in DOS
- stdin equ 0
- stdout equ 1
- stderr equ 2
- aux equ 3
- prn equ 4
- .cref
- .list
-